package daytrain.week1;

import java.util.HashSet;

public class _002 {
    public static int evenFibonacci(int num){
        //  num = 4000000;
        int num1 = 1,num2 = 2,numn = 0,res = 2;
        while (true){
            if (numn > 4000000){
                break;
            }
            numn = num1 + num2;
            num1 = num2;
            num2 = numn;
            if (numn % 2 == 0){
                res += numn;
            }
        }
        //  4613732
        return res;
    }
    /**
    public static int Recursion(int n){
        if(n==1){
            return 0;
        }
        if(n==2){
            return 1;
        }
        return Recursion(n-1)+Recursion(n-2);
    }
    */
}
